<?
include_once($_SERVER['DOCUMENT_ROOT']."/lucy/config.php");
include_once(INC.'sess.php');
include_once(CLA."dictionary.class.php");

if($_POST['name'] != "" AND $_POST['value'] != ""){
	$name = str_replace(" ", "+", $_POST['name']);
	$value = str_replace(" ", "_", $_POST['value']);
	
	$dict = new Dictionary();
	if($dict->add_translate($name, $value)){
		$_SESSION['print']['echo'] = "Pievienots jauns sinonīms <u><b>$name</b></u> modulim <b>$value</b></u>";
		$mod_name = "print";
		$send = "<meta http-equiv='refresh' content=\"0;url=http://localhost/lucy/sys/mod/".$mod_name.".php?inSess=".session_id()."\">";
		echo $send;
	}
}elseif($_POST['cancel'] == 1){
		$_SESSION['print']['echo'] = "Jauno nesaglabāju";
		$mod_name = "print";
		$send = "<meta http-equiv='refresh' content=\"0;url=http://localhost/lucy/sys/mod/".$mod_name.".php?inSess=".session_id()."\">";
		echo $send;
}
//print_r($_POST);
?>
<form action="" method="POST">
	<table border="0">
		<tr>
			<td>
				sinonīms:
			</td>
			<td>
				<input type="text" name="name">
			</td>
		</tr>
		<tr>
			<td>
				moduļa vārds:
			</td>
			<td>
				<input type="text" name="value">
			</td>
		</tr>		
		<tr>
			<td>
				
			</td>
			<td>
				<input type="submit" name="submit" value="Saglabāt">
			</td>
		</tr>
	</table>
</form>

<form action="" method="POST">
	<input type="hidden" name="cancel" value="1">
	<input type="submit" name="submit" value="Atcelt">
</form>